class Solution:
    def combine(self, n: int, k: int) -> List[List[int]]:
        res = []
        def backtrack(temp_list, n, k, start_index):
            if len(temp_list) == k:
                res.append(temp_list[:])
                return
            for i in range (start_index, n+1):
                temp_list.append(i)
                backtrack(temp_list, n, k, i+1)
                temp_list.pop()
        backtrack([], n, k ,1)
        return res
